package siac.com.controller;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

@ManagedBean
@SessionScoped
public class AuthenticatorController {
	
	private String username;
	private String password;
	private boolean loggedIn = false;
	
	
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public boolean isLoggedIn() {
		return loggedIn;
	}
	public void setLoggedIn(boolean loggedIn) {
		this.loggedIn = loggedIn;
	}	
	
	public String login(){
		if((username.toUpperCase().equals("ENSA")) && 
				(password.toUpperCase().equals("ENSA")))
			this.loggedIn = true;
        return ((loggedIn)? "success" : "fail");
    }
	
	public String logout(){
		this.username = "";
		this.password = "";
		this.loggedIn = false;
		return "logout";
    }
	
	
	
	

}
